#ifndef __STRING_PARSER_H__
#define __STRING_PARSER_H__
#include "../Settings/Settings.h"
#include "../Model/Card.h"
#include "Command.h"
#include <string>
#include <map>
#include <vector>


class StringParser
{
private:
  std::string buffer_;
  std::map<std::string, Command> commandTable_;
  std::vector<Card> cards_;

  int curPos_;
  Command command_;
  int playerNumber_;
  std::string playerName_;
  Settings &settings_;
  static const char separator_;
  
  int readToSeparator(std::string &help, int &pos);
  int readStartCommand();
  int readNum(int &num);
public:
  StringParser();
  
  int parseBuffer();

  void setBuffer(const std::string &buffer);

  Command getCommand();
  void setCommand(Command command);
 
  int getPlayerNumber();
  void setPlayerNumber(int playerNumber);

  const std::string& getPlayerName();
  void setPlayerName(const std::string &playerName);

  void setParser(Command command, int playerNumber, const std::string &playerName);
  
  const std::vector<Card>& getCards() const;
};

#endif
